在使用APP時,會有各種使用操作
同時程式也會使用不同回調
onCreate
onStart
onResume
onPause
onStop
onDestroy
onCreate
onStart
onResume
onPause
onStop
onDestroy
onCreate
onStart
onResume
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
Log.d("Activity","onCreate")
}
override fun onStart() {
super.onStart()
Log.d("Activity","onStart")
}
override fun onResume() {
super.onResume()
Log.d("Activity","onResume")
}
override fun onPause() {
super.onPause()
Log.d("Activity","onPause")
}
override fun onStop() {
super.onStop()
Log.d("Activity","onStop")
}
override fun onDestroy() {
super.onDestroy()
Log.d("Activity","onDestroy")
}
}